#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

// 已知
int n;
vector<int> a;
// 未知
long long cnt;

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a.push_back(x);
    }
    auto j = a.begin();
    for (int i = 0; i < n; ++i)
    {
        j = lower_bound(j, a.end(), a[i] * 2);
        cnt += a.end() - j;
    }
    cout << cnt << endl;
    return 0;
}